{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 146,
   "id": "2670a89d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The autoreload extension is already loaded. To reload it, use:\n",
      "  %reload_ext autoreload\n"
     ]
    }
   ],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "id": "94ef3f2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "from config import *"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "71dc9e75",
   "metadata": {},
   "source": [
    "# Difference between imperative and declarative libraries\n",
    "\n",
    "## Imperative libraries\n",
    "Specify the steps to build a chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "id": "0c155528",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAmU0lEQVR4nO3dd5wU9f3H8dcHOHqvB1JOunTwQOwFJaBGo0YFDLGCxhI1GjXml5/GNE1ssSQRELEAYk1shxIsqBEQjnbA0Tscd0c94Lj6+f2xq78LAh5wu7N7+34+HjzY3ZndeTPcvm92ZvY75u6IiEjiqBJ0ABERiS4Vv4hIglHxi4gkGBW/iEiCUfGLiCQYFb+ISIJR8YvEODO7xsy+CDqHVB4qfgmMmZ1mZv8xs11mtt3MvjSz/kHn+j5mNsHM3MwGlHmso5npSzESF1T8Eggzqw+8BzwNNAaOA34LFASQpepRPG078PuKzhJpZlYt6AwSPBW/BKUzgLtPdvcSd89394/cfSGEytjMHjWzXDNbbWa3hLeyq4WnrzWzc795MTN70MxeKXP/dTPLCn+amGFm3ctMm2BmfzezD8xsL3C2mbUyszfNLMfM1pjZz78n/4tALz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43V0DrC3ffFP47G3ib0HVLyqrQ92OiFP87wE/DR8YHArvcfUvQocws+Zv9mmY2gND/R8TLIrzM54Gl7v74IWaL+jorT64g1pmZNTOzhuHbtYDzgMwDZnsHuDp8+8fAxx4+KhdkrgP2A19E6LhJRLn7r9y9tbunEDpw+7G7/+SA2aK+vsqTK4j1ZWZ1zKzeN7eBwcCBZwJW6PsxkLF6KpqZTSZ0tkdTM9sIPEDoQBfu/g9C4wKdD6wE9gHXxkiuHwM/M7NiIB8YFukf/rBTgZHAovD+YYD7gbZlsgWxzsqTK4h11hJ40UKXDa0CvObu75nZQ8Acd3+H0C+sl81sJaED+sMinKm8uX5uZhcBxeFc10Qh10HFwPoqT64g1lcL4O3w9kw1YJK7TzWzmyAy70cN2SAikmASZVePiIiEqfhFRBKMil9EJMGo+EVEEoyKX0Qkwaj4RY6QhUYRXWNmjcP3G4XvpwQcTaRcVPwiR8jdNwB/Bx4OP/QwMMbd1wYWSuQI6Dx+kaMQHlpiLjAeGAX0cfeiYFOJlE+l+OauSLS5e5GZ/RKYCgxW6Us80a4ekaM3FNgCxMRInSLlpeIXOQpm1ofQoGgDgTujcWEfkYqi4hc5QuHRQf9O6HoB64G/AI8Gm0qk/FT8IkduFLDe3aeF7/8NOMHMzgwwk0i56aweEZEEoy1+EZEEo+IXEUkwKn4RkQSj4hcRSTAqfhGRBKPiFxFJMCp+EZEE838wgcKenEc1EAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "x = [1, 2, 3, 4, 5]\n",
    "y = [1, 4, 9, 16, 25]\n",
    "\n",
    "plt.plot(x, y)\n",
    "plt.title('Square Numbers')\n",
    "plt.xlabel('X')\n",
    "plt.ylabel('Y')\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d2f4d67a",
   "metadata": {},
   "source": [
    "## Declarative libraries\n",
    "Define what you want to achieve"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "id": "5dd72cdd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import altair as alt\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame({'x': [1, 2, 3, 4, 5], 'y': [1, 4, 9, 16, 25]})\n",
    "\n",
    "chart = alt.Chart(df).mark_line().encode(\n",
    "    x='x',\n",
    "    y='y'\n",
    ").properties(\n",
    "    title='Square Numbers'\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "489fa054",
   "metadata": {},
   "source": [
    "# Statistics Generative AI"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "id": "c95559dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><div id=d7a94cb9-fe9f-43b9-8745-1586888e8202 style=\"display:none; background-color:#9D6CFF; color:white; width:200px; height:30px; padding-left:5px; border-radius:4px; flex-direction:row; justify-content:space-around; align-items:center;\" onmouseover=\"this.style.backgroundColor='#BA9BF8'\" onmouseout=\"this.style.backgroundColor='#9D6CFF'\" onclick=\"window.commands?.execute('create-mitosheet-from-dataframe-output');\">See Full Dataframe in Mito</div> <script> if (window.commands.hasCommand('create-mitosheet-from-dataframe-output')) document.getElementById('d7a94cb9-fe9f-43b9-8745-1586888e8202').style.display = 'flex' </script> <table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>categories</th>\n",
       "      <th>hours</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Before AI</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>AI tools until 2022</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>New generative AI tools</td>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table></div>"
      ],
      "text/plain": [
       "                categories  hours\n",
       "0                Before AI     78\n",
       "1      AI tools until 2022     56\n",
       "2  New generative AI tools     36"
      ]
     },
     "execution_count": 150,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(\n",
    "    {'categories': ['Before AI', 'AI tools until 2022', 'New generative AI tools'], \n",
    "     'hours': [78,56,36]\n",
    "    })\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "id": "949f3fe4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-1542a20d6dba477c8c3cd8cd2241b5c9\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-1542a20d6dba477c8c3cd8cd2241b5c9\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-1542a20d6dba477c8c3cd8cd2241b5c9\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.17.0?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function maybeLoadScript(lib, version) {\n",
       "      var key = `${lib.replace(\"-\", \"\")}_version`;\n",
       "      return (VEGA_DEBUG[key] == version) ?\n",
       "        Promise.resolve(paths[lib]) :\n",
       "        new Promise(function(resolve, reject) {\n",
       "          var s = document.createElement('script');\n",
       "          document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "          s.async = true;\n",
       "          s.onload = () => {\n",
       "            VEGA_DEBUG[key] = version;\n",
       "            return resolve(paths[lib]);\n",
       "          };\n",
       "          s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "          s.src = paths[lib];\n",
       "        });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else {\n",
       "      maybeLoadScript(\"vega\", \"5\")\n",
       "        .then(() => maybeLoadScript(\"vega-lite\", \"4.17.0\"))\n",
       "        .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-e307a574b733947969d8977c11ef97f6\"}, \"mark\": \"bar\", \"encoding\": {\"x\": {\"field\": \"hours\", \"type\": \"quantitative\"}, \"y\": {\"field\": \"categories\", \"sort\": \"-x\", \"title\": \"\", \"type\": \"nominal\"}}, \"title\": \"Number of hours spent by developers\", \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.17.0.json\", \"datasets\": {\"data-e307a574b733947969d8977c11ef97f6\": [{\"categories\": \"Before AI\", \"hours\": 78}, {\"categories\": \"AI tools until 2022\", \"hours\": 56}, {\"categories\": \"New generative AI tools\", \"hours\": 36}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 151,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chart = alt.Chart(df).mark_bar().encode(\n",
    "    x=alt.X('hours'),\n",
    "    y=alt.Y('categories', sort='-x',title='')\n",
    ").properties(\n",
    "    title='Number of hours spent by developers'\n",
    ")\n",
    "\n",
    "chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "id": "92b136a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-bc94c1dfd74c4dc7ab165468b0b0e438\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-bc94c1dfd74c4dc7ab165468b0b0e438\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-bc94c1dfd74c4dc7ab165468b0b0e438\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.17.0?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function maybeLoadScript(lib, version) {\n",
       "      var key = `${lib.replace(\"-\", \"\")}_version`;\n",
       "      return (VEGA_DEBUG[key] == version) ?\n",
       "        Promise.resolve(paths[lib]) :\n",
       "        new Promise(function(resolve, reject) {\n",
       "          var s = document.createElement('script');\n",
       "          document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "          s.async = true;\n",
       "          s.onload = () => {\n",
       "            VEGA_DEBUG[key] = version;\n",
       "            return resolve(paths[lib]);\n",
       "          };\n",
       "          s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "          s.src = paths[lib];\n",
       "        });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else {\n",
       "      maybeLoadScript(\"vega\", \"5\")\n",
       "        .then(() => maybeLoadScript(\"vega-lite\", \"4.17.0\"))\n",
       "        .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-e307a574b733947969d8977c11ef97f6\"}, \"mark\": \"bar\", \"encoding\": {\"x\": {\"axis\": {\"labelAngle\": 0}, \"field\": \"categories\", \"sort\": \"-y\", \"title\": \"\", \"type\": \"nominal\"}, \"y\": {\"field\": \"hours\", \"type\": \"quantitative\"}}, \"title\": \"Number of hours spent by developers\", \"width\": 350, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.17.0.json\", \"datasets\": {\"data-e307a574b733947969d8977c11ef97f6\": [{\"categories\": \"Before AI\", \"hours\": 78}, {\"categories\": \"AI tools until 2022\", \"hours\": 56}, {\"categories\": \"New generative AI tools\", \"hours\": 36}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 152,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chart = alt.Chart(df).mark_bar().encode(\n",
    "    y=alt.Y('hours'),\n",
    "    x=alt.X('categories', sort='-y',title='', axis=alt.Axis(labelAngle=0))\n",
    ").properties(\n",
    "    title='Number of hours spent by developers',\n",
    "    width=350\n",
    ")\n",
    "\n",
    "chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "id": "93543804",
   "metadata": {},
   "outputs": [],
   "source": [
    "mask = df['categories'] == 'Before AI'\n",
    "baseline = df[mask]['hours'].values[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "id": "ce902378",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['perc_increase'] = abs((df['hours'] - baseline)/baseline*100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "id": "16af8cfb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     0.000000\n",
       "1    28.205128\n",
       "2    53.846154\n",
       "Name: perc_increase, dtype: float64"
      ]
     },
     "execution_count": 155,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['perc_increase']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "id": "fe281931",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-7001606e1081483099e75718d675a6ca\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-7001606e1081483099e75718d675a6ca\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-7001606e1081483099e75718d675a6ca\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.17.0?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function maybeLoadScript(lib, version) {\n",
       "      var key = `${lib.replace(\"-\", \"\")}_version`;\n",
       "      return (VEGA_DEBUG[key] == version) ?\n",
       "        Promise.resolve(paths[lib]) :\n",
       "        new Promise(function(resolve, reject) {\n",
       "          var s = document.createElement('script');\n",
       "          document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "          s.async = true;\n",
       "          s.onload = () => {\n",
       "            VEGA_DEBUG[key] = version;\n",
       "            return resolve(paths[lib]);\n",
       "          };\n",
       "          s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "          s.src = paths[lib];\n",
       "        });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else {\n",
       "      maybeLoadScript(\"vega\", \"5\")\n",
       "        .then(() => maybeLoadScript(\"vega-lite\", \"4.17.0\"))\n",
       "        .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300, \"strokeWidth\": 0}, \"axis\": {\"grid\": false, \"labelFontSize\": 15, \"titleFontSize\": 15}, \"title\": {\"fontSize\": 25, \"offset\": 20}}, \"layer\": [{\"mark\": {\"type\": \"bar\", \"color\": \"#80C11E\"}, \"encoding\": {\"text\": {\"field\": \"perc_increase\", \"format\": \".02f\", \"type\": \"quantitative\"}, \"x\": {\"axis\": {\"labelAngle\": 0}, \"field\": \"categories\", \"sort\": \"y\", \"title\": \"\", \"type\": \"nominal\"}, \"y\": {\"field\": \"perc_increase\", \"scale\": {\"domain\": [0, 100]}, \"title\": \"Percentage Increase\", \"type\": \"quantitative\"}}, \"title\": \"Increase in developers speed compared to pre-AI era\", \"width\": 350}, {\"mark\": {\"type\": \"text\", \"dy\": -10, \"fontSize\": 16}, \"encoding\": {\"text\": {\"field\": \"perc_increase\", \"format\": \".02f\", \"type\": \"quantitative\"}, \"x\": {\"axis\": {\"labelAngle\": 0}, \"field\": \"categories\", \"sort\": \"y\", \"title\": \"\", \"type\": \"nominal\"}, \"y\": {\"field\": \"perc_increase\", \"scale\": {\"domain\": [0, 100]}, \"title\": \"Percentage Increase\", \"type\": \"quantitative\"}}, \"title\": \"Increase in developers speed compared to pre-AI era\", \"width\": 350}], \"data\": {\"name\": \"data-d908d0cce4f02fca881b3cf2c76c4fe9\"}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.17.0.json\", \"datasets\": {\"data-d908d0cce4f02fca881b3cf2c76c4fe9\": [{\"categories\": \"AI tools until 2022\", \"hours\": 56, \"perc_increase\": 28.205128205128204}, {\"categories\": \"New generative AI tools\", \"hours\": 36, \"perc_increase\": 53.84615384615385}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.LayerChart(...)"
      ]
     },
     "execution_count": 158,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "base = alt.Chart(df[~mask]).encode(\n",
    "    y=alt.Y('perc_increase', scale=alt.Scale(domain=[0,100]), title='Percentage Increase'),\n",
    "    x=alt.X('categories', sort='y',title='', axis=alt.Axis(labelAngle=0)),\n",
    "    text=alt.Text('perc_increase:Q', format='.02f'),\n",
    ").properties(\n",
    "    title='Increase in developers speed compared to pre-AI era',\n",
    "    width=350\n",
    ")\n",
    "\n",
    "chart = base.mark_bar(color=iColor) + base.mark_text(dy=-10,fontSize=16)\n",
    "\n",
    "chart.configure_axis(\n",
    "        labelFontSize=labelFontSize,\n",
    "        titleFontSize=15,\n",
    "        grid=False\n",
    "    ).configure_title(fontSize=fontSize,offset=20\n",
    "    ).configure_view(strokeWidth=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aeb28455",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
